package sudoku;

import java.util.Vector;

class Constraint
{
	public final static int rowNum = 9,
							 colNum = 9,
							 regNum = 9,
							 gridNum = 81;
	
	
	public static Vector<Vector<Integer>> down = new Vector<Vector<Integer>>(colNum);
	public static Vector<Vector<Integer>> across = new Vector<Vector<Integer>>(rowNum);
	public static Vector<Vector<Integer>> region = new Vector<Vector<Integer>>(regNum);
	
	static
	{	 
		for(int i = 0; i < colNum; i++) down.add(new Vector<Integer>(colNum));
		for(int i = 0; i < rowNum; i++) across.add(new Vector<Integer>(rowNum));
		for(int i = 0; i < regNum; i++) region.add(new Vector<Integer>(regNum));
	}
	
	public static void setConstraints(int aID, int dID, int rID, int val)
	{
		across.get(aID).add(val); //trolololowiecej 
		down.get(dID).add(val);
		region.get(rID).add(val);
		
	}
	
	public static void checkConstraints(int aID, int dID, int rID, Vector<Integer> vect)
	{
		vect.removeAll(across.get(aID));
		vect.removeAll(down.get(dID));
		vect.removeAll(region.get(rID));
	}
	
	public static void removeConstraints(int aID, int dID, int rID, int val)
	{
		across.get(aID).removeElement(val);
		down.get(dID).removeElement(val);
		region.get(rID).removeElement(val);
	}

}
